<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="com.java.service.*,java.util.*,com.java.model.UserSession,com.java.util.*,java.text.SimpleDateFormat"%>
<%@ taglib uri="/WEB-INF/commontags.tld" prefix="common" %><%--페이징처리tag--%>
<jsp:include page="common/header.jsp"></jsp:include>
<%

UserSession usersession = (UserSession)session.getAttribute("user");
//String ent_id 			= (String)session.getAttribute("ent_id");

String connGroup 	= "";
String user_id 		= "";
if(usersession!=null){
	connGroup 	= CmmUtil.nvl(usersession.getConnGroup(),"0");
	user_id 	= CmmUtil.nvl(usersession.getUser_id(),"");
}

System.out.println("connGroup======>"+connGroup);
System.out.println("user_id======>"+user_id);

String keyword_gb 	= CmmUtil.nvl(request.getParameter("search_gb"),"");
String keyword 		= CmmUtil.nvl(request.getParameter("search_word"),"");
String line_number	= CmmUtil.nvl(request.getParameter("line_number"),"10");
String search_date = CmmUtil.nvl(request.getParameter("search_date"),"");

System.out.println("keyword ======> " + keyword);

String present_Year = String.valueOf(GregorianCalendar.getInstance().get(Calendar.YEAR));
//GregorianCalendar에서 1월 return 값이 0이므로 Month에는  1을 더해주어야 함
String present_Month = String.valueOf(GregorianCalendar.getInstance().get(Calendar.MONTH)+1); 
String present_Date = String.valueOf(GregorianCalendar.getInstance().get(Calendar.DATE));

if(present_Month.length() == 1){
	present_Month = "0" + present_Month; //01월,02월 ..... 09월
}

GregorianCalendar g = new GregorianCalendar();
g.add(Calendar.MONTH, 0);

String befor_Month = String.valueOf(g.get(Calendar.MONTH));

if(befor_Month.length() == 1){
	befor_Month = "0" + befor_Month; //01월,02월 ..... 09월
}

if(present_Date.length() == 1){
	present_Date = "0" + present_Date; //01일,02일 ..... 09일
}

//start_dt,close_dt,selected_year,selected_month 의 값에 받아오는 인자가 없을 경우 default로 현재 시간을 Setting
String start_dt 		= CmmUtil.nvl(request.getParameter("start_dt"),present_Year + befor_Month + present_Date);
String close_dt 		= CmmUtil.nvl(request.getParameter("close_dt"),present_Year + present_Month + present_Date);


java.util.Date date = new java.util.Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");     
String today = formatter.format(date); 

//페이징 처리 Start
	//페이지 표시정보 받기 혹은 검색입력창
	String curr_page = request.getParameter("curr_page");
	if (curr_page == null || curr_page.equals(""))
		curr_page = "1";
	String one_page = request.getParameter("one_page");
	if (one_page == null || one_page.equals(""))
		one_page = "10";
	String one_group = request.getParameter("one_group");
	if (one_group == null || one_group.equals(""))
		one_group = "10";
	
	String total_count = CmmUtil.nvl(request.getParameter("total_count"),"0");
	
	//페이징 처리 End
	
	/*
	//회차검색 위한 날짜정보 가지고 오기
	HashMap map_date = new HashMap();
	HashMap map1_date = null;
	ArrayList list_date = new ArrayList();
	CommonDaoService commonservice_date = new CommonDaoService("ComSearchDateDao");	
	map_date.put("user_id",user_id);		
	list_date = (ArrayList)commonservice_date.commonDaoMethod(map_date);
	*/
	
	
	if (search_date == null || search_date.equals(""))
		search_date =  today;   
    	
    		
	
	
	
	
	
%>
<script>
function search(){
	var frm = document.mainfrm;
	frm.curr_page.value=1;
	frm.total_count.value=0;
	frm.method = "post";
	frm.action = "/jsp/com0204l_p01.jsp";
	frm.target="_self";
	frm.submit();
}

// 페이지 번호를 눌렸을때.
function go_page(page){
	var frm = document.mainfrm;
	frm.curr_page.value = page ;			
	frm.total_count.value = "<%=total_count%>";
	frm.method = "post";
	frm.action = "/jsp/com0204l_p01.jsp";
	frm.target="_self";
	frm.submit();
}

//엑셀다운로드
function excel_down(){
	var frm = document.mainfrm;
	frm.action = "/jsp/com0204l_p01_excel.jsp";
	frm.target="_blank";
	frm.method = "post";
	frm.submit();	
}
</script>
<body>
<table width="992" border="0" cellpadding="0" cellspacing="0" align="center">
  <tr>
    <td><!--top -->
    <jsp:include page="common/top_menu.jsp"></jsp:include> 
    <!-- //top -->
    <!-- contents area -->
<form name="mainfrm" method="post" action="javascript:search();">
<input type="hidden" name="curr_page" value="<%=curr_page%>">
<input type="hidden" name="total_count" value="<%=total_count%>">

  <table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="180" valign="top">
    	<jsp:include page="left/com0201l_p04.jsp"></jsp:include>
    </td>
    <td width="21" valign="top">&nbsp;</td>
    <td valign="top" style="margin:0 0 15px 0;">
    	 <table width="790px"  border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td style="font-size:14px; color:#3b70a2; font-weight:bold; border-bottom:2px solid #c8c8c8; padding:0 0 5px 0;" align="left"><img src="/images/sub_icon1.jpg"  alt="" border="0">&nbsp;학습보고 - 주간학습보고</td>
            </tr>
        </table>
        <table width="790px"  border="0" cellpadding="0" cellspacing="0" style="margin:5px 0 0 0;">
        	<tr>
            	<td align="left"><img src="/images/archive.gif"  alt="" border="0" />강의시작날짜&nbsp;&nbsp;       	         
				   <input type="text" name="start_dt" id="start_dt" class="textbox" value="<%=start_dt %>"/>
					<script language=javascript>
					var basicCal = new calendar("FIELD:document.mainfrm.start_dt;FORMAT:2;DELIMITER:;");
    				basicCal.writeCalendar();
    				</script>
					~
					<input type="text" name="close_dt" id="close_dt" class="textbox" value="<%=close_dt %>"/>
					<script language=javascript>
					var basicCal = new calendar("FIELD:document.mainfrm.close_dt;FORMAT:2;DELIMITER:;");
    				basicCal.writeCalendar();
    				</script>
               		&nbsp;&nbsp;<a href="javascript:search()"><img src="/images/bt_search1.gif" align="absmiddle" /></a>
                </td>
                <td align="right"></a></td>
            </tr>
        </table>

		<table width="790px"  border="0" cellpadding="0" cellspacing="0">
         <tr>
        	<td width="100%">
            	<iframe name='stu_state' src="/jsp/ifm/stu_state.jsp?start_dt=<%=start_dt %>&close_dt=<%=close_dt %>"  width='100%' height='100' SCROLLING='AUTO' frameborder='0'></iframe>     
              </td>
        </tr>
        </table>

       	<table width="790px"  border="0" cellpadding="0" cellspacing="0">
         <tr>
        	<td width="100%" align=right>
            	주간학습보고는 <font color=red>Excel</font>로 받으세요. Excel로 받을시 시간이  <font color=red>지연</font>될수 있습니다. <a href="javascript:excel_down()"><img src="/images/btn_save_excel2.gif" align="absmiddle" />   
              </td>
        </tr>
        </table>
	</td>
  </tr>
</table>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<td height=10>
	</td>
</table>
	<jsp:include page="common/footer.jsp"></jsp:include>
	</td>
  </tr>
</form>
</table>
</body>
</html>
